<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"
    import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>修改會員權限資料</title>
</head>
<body>
<% if(session.getAttribute("access") == "y" ){%>
<jsp:useBean id="mydb" scope="page" class="bean.ConDbBean"/> <%//連結資料庫的bean %>

<%
      String sql="select * from SYS_SETTING WHERE S_NAME='delay_day_deadline'";
	  ResultSet rs_day=mydb.executeQuery(sql);
	  rs_day.next();
      String delay_day_num = rs_day.getString(3); //取出逾期天數底限
      
      sql="select * from SYS_SETTING WHERE S_NAME='delay_item_deadline'";
	  ResultSet rs_item=mydb.executeQuery(sql);
	  rs_item.next();
      String delay_item_num = rs_item.getString(3); //取出逾期項目數量底限
      
      sql="select * from SYS_SETTING WHERE S_NAME='damage_freq'";
	  ResultSet rs_dam=mydb.executeQuery(sql);
	  rs_dam.next();
      String dam_freq_num = rs_dam.getString(3); //取出破壞場地設備次數底限
      
    %>

<% 
	  sql="select * from MEMBER WHERE M_NUM='"+request.getParameter("num")+"'";
	  ResultSet rs=mydb.executeQuery(sql); 
	  rs.next();
      
      String Mnum = rs.getString(1);
	  String Mid = rs.getString(2);
      String Mname = rs.getString(3);
      String email = rs.getString(9);
	  String level = rs.getString(12);
	  String delay_day = rs.getString(13);
	  String delay_item = rs.getString(14);
	  String damage_pf = rs.getString(15);
	  %>
  
<table width="750" border="0" align="center">
  <tr>
    <td width="30" rowspan="4"><jsp:include page="../frameset/left.jsp" flush="true" ></jsp:include></td>
    <td colspan="2"><jsp:include page="../frameset/top.jsp" flush="true" ></jsp:include></td>
    <td width="40" rowspan="4"><jsp:include page="../frameset/right.jsp" flush="true" ></jsp:include></td>
  </tr>
  <tr>
    <td rowspan="2"><jsp:include page="../frameset/mean.jsp" flush="true" ></jsp:include>

    </td>
    <td height="32"><jsp:include page="../frameset/level_mean.jsp" flush="true" ></jsp:include></td>
  </tr>
  <tr>
    <td>
    <table width="500" cellspacing="0" cellpadding="0"> 
 <tr>
    <td align="center" valign="top" bordercolor="1">
      <div align="center">違規會員條件：逾期><%=delay_day_num%>天or逾期項目><%=delay_item_num%>項or破壞場地><%=dam_freq_num%>次 
        <table width="100%"  border="0" cellspacing="1" cellpadding="1">
          <tr>
            <td align="center" valign="top" bordercolor="#00CCFF"><div align="center">
            <form name="myForm" method="post" action="do_altermemberlevel.jsp">    <%//送出表單 %>
              <table width="100%"  border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#999999">
                <tr bgcolor="#FFFFCC">
                  <td width="30%"><div align="right"><span class="gytext11"><font class=cherry></font>帳號：</span></div></td>
                  <td width="70%"><div align="left"><span class="lggytext11">
                     <%=Mid%>
                    </span></div></td>
                </tr>
                
                <tr>
                  <td><div align="right"><span class="gytext11"><font class=cherry></font>姓名：</span></div></td>
                  <td><div align="left"><span class="lggytext11">
                      <%=Mname%>
                  </span></div></td>
                </tr>
                
                <tr bgcolor="#FFFFCC">
                  <td><div align="right"><span class="gytext11">逾期天數：</span></div></td>
                  <td><div align="left"><span class="lggytext11">
                    <input maxlength=18 size=48 value="<%=delay_day%>" name="delay_day">
                  </span></div></td>
                </tr>
                <tr>
                  <td><div align="right">逾期項目數量：</div></td>
                  <td><div align="left"><span class="lggytext11">
                    <input maxlength=40 size=48 value="<%=delay_item%>" name="delay_item">
                  </span></div></td>
                </tr>
                <tr bgcolor="#FFFFCC">
                  <td><div align="right">破壞場地次數：</div></td>
                  <td><div align="left"><span class="lggytext11">
                    <input maxlength=40 size=48 value="<%=damage_pf%>" name="damage_pf">
                  </span></div></td>
                </tr>
               <tr>
                  <td><div align="right">權限：</div></td>
                  <td><div align="left"><span class="lggytext11">
                   <select name="level">
    <option value="1" <% if(level.equalsIgnoreCase("1")) out.print("selected");%>>會員</option>
    <option value="2" <% if(level.equalsIgnoreCase("2")) out.print("selected");%>>管理者</option>
    <option value="3" <% if(level.equalsIgnoreCase("3")) out.print("selected");%>>違規會員</option>
    </select>
                  </span></div></td>
                </tr>
                <tr bgcolor="#FFFFCC">
                  <td colspan="2"><div align="right">
                      <input type="hidden" value="<%=Mnum%>" name="Mnum">
                      <input type="hidden"  name="textfield"/>
                      <input name="Submit" type="submit"  value="送出"> 
                  </div></td>
                </tr>
              </table>
            
                </form>
              </div>            </td>
          </tr>
        </table> 
    </td>
  </tr>
  <tr>
    <td colspan="2"></td>
  </tr>
</table> 
<%
  }
  else{
  	response.sendRedirect("../index.jsp"); //若沒有登入則回到index.jsp
  } 
  %>
</body>
</html>